package com.gmadmin.controller;

import com.gmadmin.common.ApiResponse;
import com.gmadmin.service.UnitPositionService;
import com.gmadmin.service.vo.UnitPositionVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "单位:职位管理")
@RestController
@RequestMapping(value = "api/unit/position")
public class UnitPositionController {

    private final UnitPositionService service;

    public UnitPositionController(UnitPositionService service) {
        this.service = service;
    }

    /**
     * 查询职位
     *
     * @return
     */
    @GetMapping
    @ApiOperation(value = "查询职位")
    public ApiResponse<List<UnitPositionVo>> getPositions() {
        return ApiResponse.ofSuccess(service.getPositions());
    }
}
